package enums

type ServerTypeEnum int

const (
	Http ServerTypeEnum = iota + 1
	Mqtt
	Database
)

type ServerType struct {
	Value string
}

func (it ServerTypeEnum) Get() ServerType {
	switch it {
	case Http:
		return ServerType{Value: "HTTP"}
	case Mqtt:
		return ServerType{Value: "MQTT"}
	case Database:
		return ServerType{Value: "DB"}
	default:
		return ServerType{}
	}
}

func GetServerType(typeName string) ServerType {
	switch typeName {
	case Http.Get().Value:
		return Http.Get()
	case Mqtt.Get().Value:
		return Mqtt.Get()
	case Database.Get().Value:
		return Database.Get()
	default:
		return ServerType{}
	}
}
